package com.zhongshu.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: MyRedissonConfig
 * @Description: TODO
 * @author: 星~
 * @date: 2021/9/13 0013 下午 15:56
 */
@Configuration
public class MyRedissonConfig {

    /**
     * 单节点配置
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {

        Config config = new Config();
        config.useSingleServer().setAddress("redis://r-bp1zctnxesj80ujsd6pd.redis.rds.aliyuncs.com:6379")
                .setPassword("Dunjx200921")
                .setDatabase(15); // 分布式锁用第15个数据库
        return Redisson.create(config);
    }




}
